package com.yzb.proxy;

import java.lang.reflect.Proxy;

public class ProxyTest {

    public static void main(String[] args) throws Exception {

        MyInterface myInterface = new MyInterfaceImpl();

        MyInterface myInterfaceProxy =(MyInterface)Proxy.
                newProxyInstance(myInterface.getClass().getClassLoader(),
                        new Class<?>[]{MyInterface.class},
                        new MyInvocationHandler(myInterface, "_proxy"));
        String name = myInterfaceProxy.getName("张三");
        System.out.println(name);
    }
}
